<template>
  <div class="wh-graph-editor-tools" :class="[showLeftSection?'show-left-section':'hide-left-section', showRightSection?'show-right-section':'hide-right-section']">
    <div class="wh-graph-editor-tools-group" v-for="(group, section) in list" :key="section">
      <el-tooltip :content="showTooltipName(item)" placement="bottom" effect="light" v-for="(item, index) in group" :key="index">
        <img class="wh-graph-editor-tools-group-item" :src="showImg(item)" alt="">
      </el-tooltip>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        ['back|上一步', 'next|下一步'],
        ['copy|拷贝', 'save|保存', 'delete|删除'],
        ['zoom-out|放大', 'zoom-in|缩小'],
        ['minus-the-bottom|图层下移', 'minus-the-top|图层上移'],
        ['full-screen|全屏', 'off-screen|退出全屏']
      ],
      showLeftSection: true,
      showRightSection: true
    }
  },
  methods: {
    showImg(item) {
      let arr = item.split('|')
      return require('../../../assets/tools/'+arr[0]+'.svg')
    },
    handleToggleSection (type) {
      if (type === 1) {
        this.showLeftSection = !this.showLeftSection
      } else if (type === 2) {
        this.showRightSection = !this.showRightSection
      }

    },
    showTooltipName (item) {
      let arr = item.split('|')
      return arr[1] || item
    }
  },
}
</script>

<style scoped lang="scss">
.wh-graph-editor-tools {
  position: absolute;
  left: 250px;
  top: 0;
  right: 250px;
  // width: 100%;
  height: 40px;
  display: flex;
  flex-direction: row;
  align-items: center;
  border-bottom: 1px solid lightgray;
  // box-shadow: 0 0 5px 5px lightgray;
  padding: 10px 20px;
  box-sizing: border-box;
  z-index: 9;
  background-color: #F5F5F5;
  &-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    &::before {
      width: 1px;
      content: '';
      height: 20px;
      background: lightgray;
      margin: 0 10px;
    }
    &:first-child::before {
      content: none;
    }
    &-item {
      height: 20px;
      padding: 0 10px;
      box-sizing: border-box;
      cursor: pointer;
    }
  }
}
.show-left-section {
  left: 250px;
  transition: all 800ms ease-in-out;
}
.hide-left-section {
  left: 0px;
  transition: all 800ms ease-in-out;
}
.show-right-section {
  right: 250px;
  transition: all 800ms ease-in-out;
}
.hide-right-section {
  right: 0;
  transition: all 800ms ease-in-out;
}
</style>
